|
|
|
|
|
|
|
to identify the field in the dataset determined by the DataSource property that will be updated. |
|
|
|
|
|
|
|
|
5. You must set the AllowAddNew property to True to permit users to add records. You must set the AllowDelete property to True to permit removal of records. |
|
|
|
|
|
|
|
|
6. Use the BeforeDelete event to confirm deletion of records. |
|
|
|
|
|
|
|
|
7. The column-level events of the data-bound grid control provide field-level validation functionality. |
|
|
|
|
|
|
|
|
8. You would use the data-bound combo box, rather than the data-bound list box, when you want to allow the user to type the entry or when space on the data entry form is limited. |
|
|
|
|
|
|
|
|
9. You use the ReBind method to refresh a data-bound grid. |
|
|
|
|
|
|
|
|
10. Subforms are typically used to display data from two different data tables that are linked through a common key. For example, subforms can display invoice detail of a customer linked by customer ID, or work orders that have been performed on a fixed asset linked by asset ID. |
|
|
|
|
|
|
|
|
Answers to Day 12 Exercises |
|
|
|
|
|
|
|
|
Complete the following steps to build this form: |
|
|
|
|
|
|
|
|
1. Add a data control (Data1) and a data-bound list box to a new form. |
|
|
|
|
|
|
|
|
2. Set the following properties of Data1: |
|
|
|
|
| |
|
|
|
|
C:\VB4\BIBLIO.MDB (include appropriate path) |
|
|
|
| | |
|
|
|
|
|
|
3. Set the DataSource property to Data1 and the ListField property to Name for the data-bound list. |
|
|
|
|
|
|
|
|
4. Add a second data control (Data2) and set its Database property to BIBLIO.MDB and its RecordSource property to Publishers. |
|
|
|
|
|
|
|
|
5. Add text fields in an array to the form. Set their DataSource properties to Data2 and their DataField properties to their respective fields. |
|
|
|
|
|
|
|
|
6. Add a third data control to the form. Set its DatabaseName to BIBLIO.MDB (include path) and its RecordSource property to Titles. |
|
|
|
|
|
|
|
|
7. Set the Visible property of all three data controls to False. |
|
|
|
|
|
|
|
|
8. Add a data-bound grid to the form. Set its DataSource property to Data3. |
|
|
|
|
|
|
|
|
9. Load the dataset column names into the grid by selecting Retrieve Fields from the context menu of the DBGrid. Then select Properties from the context menu of the DBGrid and click the Columns tab. Make sure that the Visible checkbox is selected only for the Title, Year Published, and ISBN columns. |
|
|
|
|
|